package demo7;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Spring管理对象,单例或多例
 */
public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo7");
        //Spring默认维护实例类都是单例模式
        DBConnect db1 = context.getBean(DBConnect.class);
        System.out.println(db1);

        DBConnect db2 = context.getBean(DBConnect.class);
        System.out.println(db2);
    }
}
